import java.io.*;
import java.net.*;
public class DownloadFile {
	public static void main(String args[]) throws IOException
	{

		java.io.BufferedInputStream in = new java.io.BufferedInputStream(new java.net.URL("http://somepathhere/testplans.pdf").openStream());
		java.io.FileOutputStream fos = new java.io.FileOutputStream("testplans.pdf");
		java.io.BufferedOutputStream bout = new BufferedOutputStream(fos,1024);
		byte data[] = new byte[1024];
		while(in.read(data,0,1024)>=0)
		{
			bout.write(data);
		}
		bout.close();
		in.close();
	}
} 